import { ApiProperty } from '@nestjs/swagger';
import {
  Allow,
  IsBoolean,
  IsNumber,
  IsOptional,
  IsString,
} from 'class-validator';

export class CreateProductDto {
  @ApiProperty({ description: '产品ID', required: false })
  @IsNumber()
  @IsOptional()
  id?: number;

  @ApiProperty({ description: '产品名称' })
  @IsString()
  @IsOptional()
  name?: string;

  @ApiProperty({ description: '产品描述', required: false })
  @IsString()
  @IsOptional()
  description?: string;

  @ApiProperty({ description: '产品价格', required: false })
  @IsNumber()
  @IsOptional()
  price?: number;

  @ApiProperty({ description: '产品颜色', required: false })
  @IsString()
  @IsOptional()
  imageColor?: string;

  @ApiProperty({ description: '产品功率', required: false })
  @IsNumber()
  @IsOptional()
  power?: number;

  @ApiProperty({ description: '产品温度', required: false })
  @IsNumber()
  @IsOptional()
  temperature?: number;

  @ApiProperty({ description: '产品场景', required: false })
  @IsString()
  @IsOptional()
  scene?: string;

  @ApiProperty({ description: '分类ID', required: false })
  @IsNumber()
  @IsOptional()
  categoryId?: number;

  @ApiProperty({ description: '产品评分', required: false })
  @IsString()
  @IsOptional()
  rating?: string;

  @ApiProperty({ description: '产品销量', required: false })
  @IsNumber()
  @IsOptional()
  sales?: number;

  @ApiProperty({ description: '标题链接', required: false })
  @IsString()
  @IsOptional()
  titleLink?: string;

  @ApiProperty({ description: '产品图片URL（多个用逗号分隔）' })
  @IsString()
  @IsOptional()
  images: string;

  @ApiProperty({ description: '副标题', required: false })
  @IsString()
  @IsOptional()
  subtitle?: string;

  @ApiProperty({ description: '是否推荐', default: true, required: false })
  @IsBoolean()
  @IsOptional()
  isRecommended?: boolean;
}
